package org.HisCanvas.ChrisRiffle.JFlightLog.launching;

import org.HisCanvas.ChrisRiffle.JFlightLog.persist.LogBookDAO;
import org.HisCanvas.ChrisRiffle.JFlightLog.persist.LogBookDAOHIbernate;
import org.HisCanvas.ChrisRiffle.JFlightLog.persist.LogBookDaoJpa;


/**
 * 
 * @author RIF
 *
 */
public class JFlightLogController {
	
	private static JFlightLogController singletonInstance;
	
	private LogBookDAO logBookDao; 
	
	
	/**
	 * Private constructor enforces singleton
	 */
	private JFlightLogController() {	
	}
	
	
	/**
	 * 
	 */
	public static JFlightLogController instance(){
		
		if(singletonInstance == null){
			
			singletonInstance = new JFlightLogController();
		}
		return singletonInstance;
	}
	
	
	/**
	 * getLogBookDao
	 * 
	 * @return
	 */
	public LogBookDAO getLogBookDao(){;
	
		if(logBookDao == null){
			
			//TODO FIXME inject w/spring?
//			logBookDao = new LogBookDAOHIbernate();
			
			logBookDao = new LogBookDaoJpa();
			
		}
		return logBookDao;
	}
	

}
